﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using LibArchivumAeternum;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace LibArchivumAeternumTests
{
    [TestClass]
    public class ConfigurationTest
    {
        [TestMethod]
        public void Generate()
        {
            ConfigFile.GenerateExample("c:\\windows\\temp\\Archivum_aeternum_config.xml");
            Assert.IsTrue(File.Exists("c:\\windows\\temp\\Archivum_aeternum_config.xml"));
        }

        [TestMethod]
        public void BatchBackup()
        {
            StringBuilder log = new StringBuilder();
            ArchivumAeternum aa = new ArchivumAeternum(ConfigFile.Load("archivum_aeternum_config.xml"));
            aa.OnStepStarted += (sender, message) => log.Append(message);
            aa.OnStepFinished += (sender, message) => log.AppendFormat(" {0}.\n", message);
            aa.OnStepFailed += (sender, message) => log.AppendFormat("\nERROR: {0}\n", message);
            aa.StartBatchBackup();
        }
    }
}
